package com.sali.service;

import cn.hutool.json.JSONObject;
import com.sali.handler.ProtocolModelHandle;
import lombok.Builder;
import org.springframework.stereotype.Component;

/**
 * @author: sali
 * @date: 2024/7/17 16:41.
 * @version: 1.0
 */
@Builder
@Component
public class MessageConsumeService {

    private ProtocolModelHandle protocolModelHandle;

    public MessageConsumeService(ProtocolModelHandle protocolModelHandle) {
        this.protocolModelHandle = protocolModelHandle;
    }

    public String messageConsume(String protocol, Object content) {
        JSONObject jsonObject = protocolModelHandle.handleModel(protocol, content);
        return jsonObject.toString();
    }

}
